﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XYZshell.Game.CardGameEngine
{
	public class ConditionHelper
	{
		public static List<Type> AvailableConditons
		{
			get
			{
				List<Type> rtn= new List<Type>();
				rtn.Add( typeof( SimpleCondition ) );
				rtn.Add( typeof( LogicCodition ) );
				return rtn;
			}
		}

		public static BaseCondition GetConditionInstanceByID( string id )
		{

			return Activator.CreateInstance( GetConditionByID( id ) ) as BaseCondition;

		}

		public static Type GetConditionByID( string id )
		{
			foreach (Type t in AvailableConditons)
			{
				ConditionAttribute ct= (ConditionAttribute)t.GetCustomAttributes( typeof( ConditionAttribute ), false )[0];
				if (ct.ID == id)
					return t;
			}
			return null;
		}

	}
}
